package org.projectwithoutname.ui.util;

import java.util.ArrayList;

import org.projectwithoutname.commons.Commons;

public class Hide {
	private ArrayList<String> hideBack = new ArrayList<String>();
	private ArrayList<String> hideForward = new ArrayList<String>();

	public Hide(){
	}
	
	public void backAct(String perspectiveID){
		if (perspectiveID != null)
			hideBack.add(perspectiveID);
		else
			new NullPointerException();
		System.out.println("backward: "+hideBack.size());
		System.out.println("forward: "+hideForward.size());
	}
	
	public void forwardAct(String perspectiveID){
		if (perspectiveID != null)
			hideForward.add(perspectiveID);
		else
			new NullPointerException();
		System.out.println("backward: "+hideBack.size());
		System.out.println("forward: "+hideForward.size());
	}
	
	/**
	 * Must be used Commons.RIGHT or Commons.LEFT at agr0
	 * @param arg0
	 * @return id of the perspective
	 */
	public String getLastHide(int arg0){
		String element = null;
		if (arg0 == Commons.LEFT){
			 element = hideBack.get(hideBack.size()-1);
			 hideBack.remove(hideBack.size()-1);
		}
		else{
			element = hideForward.get(hideForward.size()-1);
			hideForward.remove(hideForward.size()-1);
		}
		return element;
	}
}
